<? 

require('./includes/config.php');
require('./includes/func_database.php');

$dbh = initConnection();

//$shinobu_points = selectMultiQuery("SELECT user_id, IF( SUM( rp_gained ) - SUM( rp_spend ) >0, FLOOR( (
//SUM( rp_gained ) - SUM( rp_spend ) ) /2 ) , SUM( rp_gained ) - SUM( rp_spend )
//) AS  'rp_change'
//FROM raid_points
//WHERE category_id = 4
//GROUP BY user_id
//", $dbh);

foreach ($shinobu_points as $point) {

	
	
	//if($point['rp_change'] < 0)
		insertQuery("INSERT into raid_points (raid_id, user_id, admin_pid, rp_gained, rp_spend, category_id, description) VALUES (-1, {$point['user_id']}, -1, 0, {$point['rp_change']}, 4, 'SYSTEM WOTLK UPDATE')", $dbh);
	//else
		//insertQuery("INSERT into raid_points (raid_id, user_id, admin_pid, rp_gained, rp_spend, category_id, description) VALUES (-1, {$point['user_id']}, -1, {$point['rp_change']}, 0, 4, 'SYSTEM WOTLK UPDATE')", $dbh);
}

?>